    #include<stdio.h>
        #include<stdlib.h>
        #include<sys/types.h>
        #include<sys/stat.h>
        #include<fcntl.h>
        #include<unistd.h>
        #include<linux/input.h>

        /*事件结构体*/
        struct input_event buff;

        int main(int argc ,char **argv)
        {
            int fd;
            int count;
            /*打开设备文件*/
            fd = open("/dev/event0",O_RDWR);

            if(fd == -1)
            {
                printf("Open Failed!\n");

                exit(-1);
            }

            while(1)
            {
                /*读操作*/
                if(count = read(fd,&buff,sizeof(struct input_event))!=0)
                {
                    printf("type: %d\tcode: %d\t value: %d\n",buff.type,buff.code,buff.value);
                }
            }
           
            close(fd);
            exit(0);
        }